package com.fl.springcloud.service;

import com.fl.springcloud.entities.CommonResult;
import com.fl.springcloud.entities.PayMent;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@Component
@FeignClient(value = "CLOUD-PAYMENT-SERVICE",fallback = PaymentHystrixService.class)
public interface PaymentFeignService {

    @GetMapping(value = "/getPayment/{id}")
    public CommonResult<PayMent> getPayment(@PathVariable("id") Long id );

    @PostMapping(value = "/payment/save")
    public CommonResult save(@RequestBody PayMent payMent);

    @GetMapping(value = "/payment/feign/timeout")
    public String PaymentFeignTimeout();

    @GetMapping(value = "payment/hystrix/ok/{id}")
    public String payment_ok(@PathVariable("id") Integer id);

    @GetMapping(value = "payment/hystrix/timeout/{id}")
    public String payment_timeout(@PathVariable("id") Integer id);

    @GetMapping(value = "payment/zipkin")
    public void zipkin();
}
